<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jQuery.min.js"></script>
</head>

<body>
    <div class="father">
        <div class="son">
            儿子
        </div>
    </div>

    <div class="nav">
        <p>我是屁</p>
        <div>
            <p>我是p</p>
        </div>
    </div>

    <script>
        $(() => {
            //1.父
            console.log($('.son').parent());

            //2.子
            //2.1 只选择亲儿子的 类似子代选择器 ul>li
            $('.nav').children('p').css('color', 'pink')
            //2.2 选择子孙后代 类似于后代选择器 ul li
            $('.nav').find('p').css('background', 'skyblue')

            //3.兄
            $('.nav').children('p').siblings('div').css('color', 'pink')

        })
    </script>

</body>

</html>